package de.dhbw.vs.permachat.server.persistence;

/*import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;*/
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * Singleton wrapper for EntityManagerFactory.
 * See {@link https://developers.google.com/appengine/docs/java/datastore/jpa/overview}
 * @author flo
 *
 */
public final class EMF {
    private static final EntityManagerFactory emfInstance = Persistence.createEntityManagerFactory("permaChatUnit");

    private EMF() {}

    public static EntityManagerFactory get() {
        return emfInstance;
    }
    
    /*@Produces
    @RequestScoped
    public EntityManager createManagedEntityManager() {
        return EMF.get().createEntityManager();
    }

    public void close(@Disposes EntityManager em) {
        em.close();
    }*/
}
